<?php
/**
 * Created by PhpStorm.
 * User: Colin
 * Date: 2018/6/28
 * Time: 10:50
 */

namespace app\library;


class Validate
{
    //手机号码验证
    public static function phone($phone)
    {
        if(preg_match("/^1[34578]{1}\d{9}$/",$phone)){
            return true;
        }else{
            return false;
        }
    }
    //邮箱格式验证
    public static function email($email)
    {
        $pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
        if ( preg_match( $pattern, $email ) )
        {
            return true;
        }else{
            return false;
        }
    }

}